<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>凡客-会员中心-我的订单</title>
		<link rel="stylesheet" type="text/css" href="<?php echo __PUBLIC__?>/Home/org/bootstrap-3.3.5-dist/css/bootstrap.min.css" />
		<script src="<?php echo __PUBLIC__?>/Home/js/jquery-1.7.2.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="<?php echo __PUBLIC__?>/Home/org/bootstrap-3.3.5-dist/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>

		<link rel="stylesheet" type="text/css" href="<?php echo __PUBLIC__?>/Home/css/address.css" />

		<!-- 城市联动 -->
		<script type="text/javascript" src="<?php echo __PUBLIC__?>/Home/js/area.js"></script>
		<script type="text/javascript">
			$(function(){
				// 初始化方法
				area.init('area');
				area.selected('北京市','北京','东城区');
			})
		</script>

		<!-- 弹窗插件 -->
		<script src="<?php echo __PUBLIC__?>/Home/js/qikoo.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="<?php echo __PUBLIC__?>/Home/css/qikoo.css" />
	</head>

	<body>
		<!--顶部灰色区域-->
		<div id="top">
			<div class="header">
				<div class="header_left">
					<div class="welcome">
			            您好,
			                            
			            <span><a href="" style="color:#A10000;">tzp215</a> <a href="http://localhost/xiangmu/shop/index.php?m=Home&c=Login&a=out" style="color:#A10000;"> 退出登陆 </a> | <a href="http://localhost/xiangmu/shop/index.php?m=Home&c=Login&a=tab" style="color:#A10000;">切换用户</a></span>
			            			            </div>
					<div class="collect">
						                
						<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=Member&a=dingdan">我的订单</a>
												<a href="">收藏本站</a>
					</div>
				</div>
				<div class="header_right">
					<ul>
						<li>
							<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=Member&a=index">我的凡客<span></span></a>
							<div class="listBox">
								<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=Member&a=index">我的凡客<span></span></a>
								<ul style="clear: both;">
									<li><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=Member&a=dingdan">我的订单</a></li>
									<li><a href="">我的收藏</a></li>
								</ul>
							</div>
						</li>
						<li>
							<a href="">帮助中心<span></span></a>
							<div class="listBox">
								<a href="">帮助中心<span></span></a>
								<ul>
									<li><a href="">购物指南</a></li>
									<li><a href="">配送方式</a></li>
									<li><a href="">支付方式</a></li>
									<li><a href="">售后服务</a></li>
									<li><a href="">投诉建议</a></li>
									<li><a href="">在线客服</a></li>
								</ul>
							</div>
						</li>
						<li>
							<a href="">网站公告<span></span></a>
							<div class="listBox">
		                        <a href="">网站公告<span></span></a>
		                        <ul>
		                            <li><a href="">春节公告</a></li>
		                            <li><a href="">网站公告</a></li>
		                            <li><a href="">重要提示</a></li>
		                        </ul>
		                    </div>
						</li>
						<li><a href="">手机凡客<span class="tel"></span></a></li>
						<li><a href="">在线客服<span class="line"></span></a></li>
					</ul>
					<a href="" class="weibo"></a>
					<a href="" class="weixin"></a>
				</div>
			</div>
		</div>
		<!--顶部灰色区域结束-->
		<!--搜索区域-->
		<script type="text/javascript">
        $(function(){
            $(document).on("mouseenter", ".carttop", function(){ 
                // alert(1);
                $.ajax({
                    url: 'http://localhost/xiangmu/shop/index.php?m=Home&c=Index&a=ajaxCart',
                    type: 'POST',
                    dataType: 'json',
                    data: {param1: 'value1'},
                    success:function(arr){
                        console.log(arr);
                        if(arr.goods.length!=0){
                            tr = '<a href="index.php?m=Home&c=car&a=index" class="carttop">购物车（'+arr.total_rows+'）</a><div class="index_2"></div><div class="index_1">最近加入的商品：<br /><ul>';
                            $.each(arr.goods, function(k, v) {
                                tr += '<li><input type="hidden" name="gid" value="'+k+'" /><div><img src="'+v.pic+'" alt="" /></div><div><a href="index.php?m=Home&c=Desc&a=index&gid='+v.id+'" class="gname">'+v.name+'&nbsp;';
                                    $.each(v.options, function(kk, vv) {
                                        tr += vv;
                                    });
                                tr += '</a><p class="price"> ￥'+v.price+'×'+v.num+'</p></div><div class="gdel"><a href="javascript:;" class="cardel">删除</a></div></li>';
                            });
                            tr += '</ul><div class="total"><p>共计(未计算促销折扣)<br />￥'+arr.total+'</p><a href="index.php?m=Home&c=car&a=index" class="showcart">查看购物车（'+arr.total_rows+'）</a></div></div>';
                            $('.shoppingcart').html(tr);
                        }else{
                            tr = '<a href="index.php?m=Home&c=car&a=index" class="carttop">购物车（0）</a><div class="index_2"></div><div class="index_1">您的购物车中没有任何商品</div>';
                            $('.shoppingcart').html(tr);
                        }
                    }
                })
            });
        })
        // 异步删除购物车中的商品
        // 高版本下不支持live事件  用on代替
        $(function(){
            $(document).on("click", ".cardel", function(){ 
                var _this=$(this);
                // alert(1);
                // 获得商品序号
                var gid = $(this).parents('li').find('input[name=gid]').val();
                // alert(gid);
                $.ajax({
                    url: 'http://localhost/xiangmu/shop/index.php?m=Home&c=Index&a=ajaxDel',
                    type: 'POST',
                    dataType: 'json',
                    data: {gid: gid},
                    success:function(arr){
                        if(arr.total!=0){
                            tr = '购物车（'+arr.total+'）';
                            $('.shoppingcart .carttop').text(tr);
                            $('.shoppingcart .total').html('<p>共计(未计算促销折扣)<br />￥'+arr.total+'</p><a href="index.php?m=Home&c=car&a=index" class="showcart">查看购物车（'+arr.total_rows+'）</a>')
                            _this.parents('li').remove();
                        }else{
                            tr = '<a href="index.php?m=Home&c=car&a=index" class="carttop">购物车（0）</a><div class="index_2"></div><div class="index_1">您的购物车中没有任何商品</div>';
                            $('.shoppingcart').html(tr);
                        }
                    }
                })
            });
        })
    </script>
		<div id="seek">
			<div class="logo">
				<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=Index&a=index"></a>
			</div>
			<div class="search_">
				<div class="searchTab">
					<form action="" method="post">
						<input type="text" class="searchTab_1" placeholder="搜“羽绒服”，体验与众不同" />
						<input type="submit" value="" class="searchTab_2" />
					</form>
					<div class="shoppingcart">
                                    <a href="index.php?m=Home&c=car&a=index" class="carttop">购物车（0）</a>
                    <div class="index_2"></div>
                    <div class="index_1">您的购物车中没有任何商品</div>
                
                           </div>
				</div>
				<div class="searchText">
					热门搜索：<a href="">羽绒服</a><a href="">外套</a><a href="">衬衫</a><a href="">针织衫</a><a href="">帆布鞋</a>
				</div>
			</div>
		</div>
		<!--搜索区域结束-->
		<!--导航条-->
		<div id="menu">
			<div class="all" style="position: relative;">全部商品分类
				<span></span>
				<div class="all_menu">

				<!-- 控制单独样式 -->
		        <script type="text/javascript">
		            $(function(){
		                $('.all_menu div dl dd a:first-child').removeClass('index');
		            })
		        </script>
				<!-- 男装 女装 -->
										<div>
					<dl>
						<h4><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=1" target="_blank">男装</a></h4>
													<dt><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=4" target="_blank">衬衫</a></dt>
							<dd>
																<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=9" target="_blank" class="index">免烫</a>
																<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=10" target="_blank" class="index">法兰绒</a>
																<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=11" target="_blank" class="index">牛仔布</a>
																<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=12" target="_blank" class="index">牛津纺</a>
															</dd>
													<dt><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=5" target="_blank">针织衫</a></dt>
							<dd>
																<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=13" target="_blank" class="index">羊毛衫</a>
																<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=14" target="_blank" class="index">羊绒衫</a>
																<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=15" target="_blank" class="index">棉线衫</a>
															</dd>
													<dt><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=6" target="_blank">外套</a></dt>
							<dd>
																<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=16" target="_blank" class="index">羽绒服</a>
																<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=17" target="_blank" class="index">冲锋衣</a>
																<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=18" target="_blank" class="index">羊毛外套</a>
																<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=19" target="_blank" class="index">卫衣</a>
															</dd>
													<dt><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=7" target="_blank">裤装</a></dt>
							<dd>
																<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=20" target="_blank" class="index">牛仔裤</a>
																<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=21" target="_blank" class="index">休闲裤</a>
																<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=22" target="_blank" class="index">运动裤</a>
															</dd>
											</dl>
					</div>
										<div>
					<dl>
						<h4><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=2" target="_blank">女装</a></h4>
													<dt><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=8" target="_blank">上装</a></dt>
							<dd>
																<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=24" target="_blank" class="index">羽绒服</a>
																<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=25" target="_blank" class="index">针织衫</a>
																<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=26" target="_blank" class="index">卫衣</a>
																<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=27" target="_blank" class="index">羊毛大衣</a>
															</dd>
													<dt><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=23" target="_blank">裤装</a></dt>
							<dd>
																<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=28" target="_blank" class="index">牛仔裤</a>
																<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=29" target="_blank" class="index">运动裤</a>
																<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=30" target="_blank" class="index">打底裤</a>
															</dd>
											</dl>
					</div>
									<!-- 鞋袜 -->
					<div>
					<dl>
						<h4>
											            <a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=31" target="_blank" style="float:left;">鞋/</a>
				            				            <a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=32" target="_blank" style="float:left;">家居/</a>
				            				            <a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=33" target="_blank" style="float:left;">袜品/</a>
				            				            <a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=34" target="_blank" style="float:left;">内衣/</a>
				            						</h4>
						<dd>
											            <a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=31" target="_blank" class="index">鞋</a>
				            				            <a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=32" target="_blank" class="index">家居</a>
				            				            <a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=33" target="_blank" class="index">袜品</a>
				            				            <a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=34" target="_blank" class="index">内衣</a>
				            						</dd>
					</dl>
					</div>
				</div>	
			</div>
			<ul>
								<li>
					<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=12" class="fir_menu">牛津纺</a>
					<div class="sec_menu">
												<div class="sec_menu_clo">
							<img src="Upload/img/160308/6391457437399.jpg" />
							<h3><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=Desc&a=index&gid=6">凡客衬衫 牛津纺 吉国武 男款</a></h3>
							<span>￥199</span>
						</div>
						<div class="sec_menu_line"></div>
												<div class="sec_menu_clo">
							<img src="Upload/img/160308/46001457437841.jpg" />
							<h3><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=Desc&a=index&gid=7">凡客衬衫 牛津纺 男款</a></h3>
							<span>￥149</span>
						</div>
						<div class="sec_menu_line"></div>
											</div>
				</li>
								<li>
					<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=15" class="fir_menu">棉线衫</a>
					<div class="sec_menu">
												<div class="sec_menu_clo">
							<img src="Upload/img/160310/95741457571535.jpg" />
							<h3><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=Desc&a=index&gid=8">凡客棉线衫 圆领 男款</a></h3>
							<span>￥149</span>
						</div>
						<div class="sec_menu_line"></div>
												<div class="sec_menu_clo">
							<img src="Upload/img/160310/64301457580909.jpg" />
							<h3><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=Desc&a=index&gid=14"> 凡客棉线衫 开衫 男款</a></h3>
							<span>￥199</span>
						</div>
						<div class="sec_menu_line"></div>
											</div>
				</li>
								<li>
					<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=16" class="fir_menu">羽绒服</a>
					<div class="sec_menu">
												<div class="sec_menu_clo">
							<img src="Upload/img/160310/32371457581956.jpg" />
							<h3><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=Desc&a=index&gid=15">凡客羽绒服 匈牙利鹅绒 男款</a></h3>
							<span>￥499</span>
						</div>
						<div class="sec_menu_line"></div>
												<div class="sec_menu_clo">
							<img src="Upload/img/160310/82101457590938.jpg" />
							<h3><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=Desc&a=index&gid=16">超轻暖连帽羽绒服 男款</a></h3>
							<span>￥149</span>
						</div>
						<div class="sec_menu_line"></div>
											</div>
				</li>
								<li>
					<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=18" class="fir_menu">羊毛外套</a>
					<div class="sec_menu">
												<div class="sec_menu_clo">
							<img src="Upload/img/160310/95481457592017.jpg" />
							<h3><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=Desc&a=index&gid=18">凡客羊毛大衣 连帽绳扣</a></h3>
							<span>￥699</span>
						</div>
						<div class="sec_menu_line"></div>
												<div class="sec_menu_clo">
							<img src="Upload/img/160311/4021457680488.jpg" />
							<h3><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=Desc&a=index&gid=21">凡客羊毛大衣 双排扣</a></h3>
							<span>￥799</span>
						</div>
						<div class="sec_menu_line"></div>
											</div>
				</li>
								<li>
					<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=19" class="fir_menu">卫衣</a>
					<div class="sec_menu">
												<div class="sec_menu_clo">
							<img src="Upload/img/160310/72671457592471.jpg" />
							<h3><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=Desc&a=index&gid=19">凡客卫衣 连帽开衫 男款</a></h3>
							<span>￥199</span>
						</div>
						<div class="sec_menu_line"></div>
												<div class="sec_menu_clo">
							<img src="Upload/img/160310/42941457592758.jpg" />
							<h3><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=Desc&a=index&gid=20">Vancl by Scott 男款 长袖 卫衣 CM1750</a></h3>
							<span>￥279</span>
						</div>
						<div class="sec_menu_line"></div>
											</div>
				</li>
								<li>
					<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=27" class="fir_menu">羊毛大衣</a>
					<div class="sec_menu">
												<div class="sec_menu_clo">
							<img src="Upload/img/160311/9661457684439.jpg" />
							<h3><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=Desc&a=index&gid=32">凡客手工大衣 连帽长款大衣 女款</a></h3>
							<span>￥499</span>
						</div>
						<div class="sec_menu_line"></div>
												<div class="sec_menu_clo">
							<img src="Upload/img/160311/82621457684811.jpg" />
							<h3><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=Desc&a=index&gid=33">凡客手工大衣 立领短大衣 女款</a></h3>
							<span>￥399</span>
						</div>
						<div class="sec_menu_line"></div>
											</div>
				</li>
								<li>
					<a href="http://localhost/xiangmu/shop/index.php?m=Home&c=List&a=index&cid=28" class="fir_menu">牛仔裤</a>
					<div class="sec_menu">
												<div class="sec_menu_clo">
							<img src="Upload/img/160311/32211457686029.jpg" />
							<h3><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=Desc&a=index&gid=34">凡客牛仔裤 轻弹 弹力紧身 女款</a></h3>
							<span>￥149</span>
						</div>
						<div class="sec_menu_line"></div>
												<div class="sec_menu_clo">
							<img src="Upload/img/160311/58441457686277.jpg" />
							<h3><a href="http://localhost/xiangmu/shop/index.php?m=Home&c=Desc&a=index&gid=35">凡客牛仔裤 中腰短裤 女款</a></h3>
							<span>￥129</span>
						</div>
						<div class="sec_menu_line"></div>
											</div>
				</li>
								<li><a href="" class="fir_menu">特惠频道</a></li>
			</ul>
		</div>
		<!--导航条结束-->
		<!--主体部分-->

		<div id="position">
			您当前的位置：<a href="<?php echo U('Index/index')?>">凡客首页</a> > <a href="<?php echo U('index')?>">我的凡客</a> > <a href="javascript:;">收货地址</a>
		</div>
		<div id="welcome">
			<div id="side-nav">
				<h2><a href="<?php echo U('index')?>">我的凡客</a></h2>
				<ul>
					<li>
						<h3>订单中心</h3>
					</li>
					<li>
						<a href="<?php echo U('dingdan')?>">·我的订单</a>
					</li>

				</ul>
				<ul>
					<li>
						<h3>客户服务</h3>
					</li>
					<li>
						<a href="<?php echo U('tui')?>">·退换货办理</a>
					</li>

				</ul>
				<ul>
					<li>
						<h3>账户管理</h3>
					</li>
					<li>
						<a href="<?php echo U('record')?>">·账户记录</a>
					</li>
					<li class="index">
						<a href="javascript:;">·收货地址</a>
					</li>
					<li>
						<a href="<?php echo U('safe')?>">·修改密码</a>
					</li>
					<li>
						<a href="<?php echo U('ziliao')?>">·我的资料</a>
					</li>

				</ul>
			</div>

			<!--内容部分-->
			<!--右侧区域-->
			<!-- 判断默认地址 -->
			<script type="text/javascript">
				$(function(){
					$.each($('.nr_tab input[name=is_def]'), function(k, v) {
						var def = $(this).val();
						if(def==1){
							$(this).parents('tr').addClass('tab_sel').siblings('tr').removeClass('tab_sel');
							$(this).parents('td').find('div').html('<p class="moRen">默认地址</p><a href="javascript:;" class="add_edit">编辑</a>')
						}
					});
					// 编辑默认地址
					$('.moRen').live('click', function() {
						var _this = $(this);
						// 判断是否选中
						var def = $(this).parents('td').find('span input[name=is_def]').val();
						if(def==1){
							return;
						};
	
						// 获得对应的地址adid
						var adid = $(this).parents('td').find('p input[name=adid]').val();
						// alert(adid);
						// 异步发送
						$.ajax({
							url: '<?php echo U('ajaxMo')?>',
							type: 'POST',
							dataType: 'json',
							data: {adid: adid},
							success:function(data){
								if(data.status){
									// 恢复默认
									$('tr.tab_sel').find('span input[name=is_def]').val(0);
									$('tr.tab_sel td.index').find('div').html('<a class="moRen" href="javascript:;">设为默认</a><a href="javascript:;" class="add_edit">编辑</a><a href="javascript:;" class="add_del">删除</a>');
									// 再设置默认
									_this.parents('tr').addClass('tab_sel').siblings('tr').removeClass('tab_sel');
									_this.parents('td.index').find('span input[name=is_def]').val(1);
									_this.parents('td.index').find('div').html('<p class="moRen">默认地址</p><a href="javascript:;" class="add_edit">编辑</a>');
								}
							}
						})
					});
				})
			</script>
			<div class="nR_r">
				<div class="nR_r_1">
					<h3>
					<span>收货地址</span>
				</h3>
					<div class="nR_r_2">
						<table class="nr_tab" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<th width="86">收货人</th>
								<th>详细地址 </th>
								<th width="108">电话/手机</th>
								<th width="106">操作 </th>
							</tr>
							<?php foreach ($address as $k=>$v){?>
							<tr>
								<td><?php echo $v['consignee']?></td>
								<td><?php echo $v['district']?> <?php echo $v['detail']?>,<?php echo $v['postcode']?></td>
								<td><?php echo $v['tel']?></td>
								<td class="index">
									<div>
										<a class="moRen" href="javascript:;">设为默认</a>
										<a href="javascript:;" class="add_edit">编辑</a><a href="javascript:;" class="add_del">删除</a>
									</div>
									<span><input type="hidden" name="is_def" value="<?php echo $v['is_def']?>" /></span>
									<p>
										<input type="hidden" name="adid" value="<?php echo $v['adid']?>" />
									</p>
								</td>
							</tr>
							<?php }?>
						</table>

						<!-- 单击显示添加地址框 -->
						<script type="text/javascript">
							$(function(){
								$('.addshow').toggle(function() {
									$(this).addClass('index');
									$('.city').css('display', 'block');
								}, function() {
									$(this).removeClass('index');
									$('.city').css('display', 'none');
								});
							})
						</script>

						<!-- 提示框显隐 -->
						<script type="text/javascript">
							$(function(){
								$('.city li input').blur(function() {
									if($(this).val().length==0){
										$(this).parents('li').find('.adhide').css('display', 'block');
									}else{
										$(this).parents('li').find('.adhide').css('display', 'none');
									}
								});
								$('.city li select').blur(function() {
									if($(this).val()==0){
										$(this).parents('li').find('.adhide').css('display', 'block');
									}else{
										$(this).parents('li').find('.adhide').css('display', 'none');
									}
								});
							})
						</script>

						<!-- 添加新地址异步 -->
						<script type="text/javascript">
							$(function(){
								$('#add').submit(function() {
									var x = 1;
									// 判断是否填写内容
									$.each($('.city li input'), function(k, v) {
										if($(this).val().length==0){
											$(this).parents('li').find('.adhide').css('display', 'block');
											x = 0;
										}
									});
									if(x == 0) return false;
									var data = $('#add').serialize();
									// 异步发送
									$.ajax({
										url: '<?php echo U('ajaxAddress')?>',
										type: 'POST',
										dataType: 'json',
										data: data,
										success:function(data){
											// console.log(data);
											if(data.is_def==0){
												var tr = '<tr><td>'+data.consignee+'</td><td>'+data.district+' '+data.detail+','+data.postcode+'</td><td>'+data.tel+'</td><td class="index"><div><a class="moRen" href="javascript:;">设为默认</a><a href="javascript:;" class="add_edit">编辑</a><a href="javascript:;" class="add_del">删除</a></div><span><input type="hidden" name="is_def" value="'+data.is_def+'" /></span><p><input type="hidden" name="adid" value="'+data.adid+'" /></p></td></tr>';
												$('table.nr_tab').append(tr);
											}else{
												// 恢复默认
												$('tr.tab_sel').find('span input[name=is_def]').val(0);
												$('tr.tab_sel td.index').find('div').html('<a class="moRen" href="javascript:;">设为默认</a><a href="javascript:;" class="add_edit">编辑</a><a href="javascript:;" class="add_del">删除</a>');
												$('tr.tab_sel').removeClass('tab_sel');
												// 添加
												var tr = '<tr class="tab_sel"><td>'+data.consignee+'</td><td>'+data.district+' '+data.detail+','+data.postcode+'</td><td>'+data.tel+'</td><td class="index"><div><p class="moRen">默认地址</p><a href="javascript:;" class="add_edit">编辑</a></div><span><input type="hidden" name="is_def" value="'+data.is_def+'" /></span><p><input type="hidden" name="adid" value="'+data.adid+'" /></p></td></tr>';
												$('table.nr_tab').find('tr').eq(0).after(tr);
											}
											// 添加框隐藏  重置表单
											$('#add')[0].reset();
											$('.addshow').removeClass('index');
											$('.city').css('display', 'none');
										}
									})
									
									return false;
								});
							})
						</script>

						<!-- 删除地址异步 -->
						<script type="text/javascript">
							$(function(){
								$('.add_del').live('click', function() {
									var _this = $(this).parents('tr');
									var adid = _this.find('input[name=adid]').val();
									qikoo.dialog.confirm('确定要删除此地址吗？',function(){
										// alert(adid);
										$.ajax({
											url: '<?php echo U('ajaxAddDel')?>',
											type: 'POST',
											dataType: 'json',
											data: {adid: adid},
											success:function(data){
												if(data.status){
													// qikoo.dialog.alert(data.message);
													_this.remove();
												} 
											}
										})
								    });
								});
							})
						</script>

						<!-- 添加新地址 -->
						<form action="" method="post" id="add">
							<div class="tianJia">
								<a class="addshow">添加新地址</a>
								<div class="city">
									<ul>
										<li>
											<p class="title"><span>*</span> 收&nbsp;&nbsp;货&nbsp;&nbsp;人：</p>
											<input type="text" name="consignee" placeholder="请准确填写真实姓名" class="consignee" />
											<div class="white"></div>
											<div class="adhide"><span></span>
												<p>请准确填写真实姓名 </p>
											</div>
										</li>
										<li>
											<p class="title"><span>*</span> 地　　区：</p>
											<select name="district[]" id="area1"></select>
											<select name="district[]" id="area2"></select>
											<select name="district[]" id="area3"></select>
											<div class="white"></div>
											<div class="adhide"><span></span>
												<p>请选择省份 </p>
											</div>
										</li>
										<li>
											<p class="title"><span>*</span> 详细地址：</p>
											<input type="text" name="detail" placeholder="请填写详细路名及门牌号" class="detail" />
											<em> 配送范围与配送时间 </em>
											<div class="white"></div>
											<div class="adhide"><span></span>
												<p>请填写详细路名及门牌号 </p>
											</div>
										</li>
										<li>
											<p class="title"><span>*</span> 邮政编码：</p>
											<input type="text" name="postcode" placeholder="请填写正确的邮政编码" class="postcode" />
											<div class="white"></div>
											<div class="adhide"><span></span>
												<p>请填写正确的邮政编码 </p>
											</div>
										</li>
										<li>
											<p class="title"><span>*</span> 手　　机：</p>
											<input type="text" name="tel" placeholder="请填写正确的手机号码" class="tel" />
											<div class="white"></div>
											<div class="adhide"><span></span>
												<p>请填写正确的手机号码 </p>
											</div>
										</li>
									</ul>
									<p class="def">
										<input type="checkbox" name="is_def" id="" value="1" />设置为默认收货地址</p>
									<input type="submit" value="" class="tijiao">
								</div>
							</div>
						</form>

					</div>
				</div>
			</div>
			<!--右侧区域结束-->

		</div>
		<!-- 编辑地址框 -->
		<script type="text/javascript">
			$(function(){
				var x = 0;
				$('.add_edit').live('click', function() {
					x = $(this).parents('tr').index();
					// alert(x);
					$( '<div id="city"></div>' ).css( {
						width : $(document).width(),
	 					height : $(document).height(),
	 					position : 'absolute',
	 					top : 0,
	 					left : 0,
	 					zIndex : 998,
	 					opacity : 0.3,
	 					filter : 'Alpha(Opacity = 30)',
	 					backgroundColor : '#000000'
					} ).appendTo( 'body' );
					// 模态框显示
					var obj = $( '.city_edit' );
					obj.css( {
						left : ( $( window ).width() - obj.width() ) / 2,
						top : ( $( window ).height() - obj.height() ) * 1 / 3
					} ).fadeIn();

					var adid = $(this).parents('tr').find('input[name=adid]').val();
					// alert(adid);
					// 异步拉取数据
					$.ajax({
						url: '<?php echo U('ajaxEdit')?>',
						type: 'POST',
						dataType: 'json',
						data: {adid:adid},
						success:function(data){
							$('.city_edit input[name=consignee]').val(data.consignee);
							$('.city_edit input[name=detail]').val(data.detail);
							$('.city_edit input[name=postcode]').val(data.postcode);
							$('.city_edit input[name=tel]').val(data.tel);

							$('.city_edit li.hide').html('<input type="hidden" name="adid" value="'+data.adid+'"><input type="hidden" name="is_def" value="'+data.is_def+'">');
							// 初始化
							area.init("areas");
							area.selected(data.district[0],data.district[1],data.district[2]);
						}
					})
					// 返回页面
					$('.adclose,.quxiao').click(function(){
						$('.city_edit').fadeOut('slow',function(){
							$('#city').remove();
						});
						return false;
					} );
				});

				// <!-- 编辑异步 -->
				$('#form_edit').submit(function() {
					// alert(x);
					var y = 1;
					// 判断是否填写内容
					$.each($('.city_edit li input'), function(k, v) {
						if($(this).val().length==0){
							$(this).parents('li').find('.adhide').css('display', 'block');
							y = 0;
						}
					});
					if(y == 0) return false;
					
					// alert(1);
					var data=$('#form_edit').serialize();
					$.ajax({
						url: '<?php echo U('ajaxTj')?>',
						type: 'POST',
						dataType: 'json',
						data: data,
						success:function(data){
							// 弹框隐藏
							$('.city_edit').fadeOut('slow', function(){
								$('#city').remove();
							});
							$('#form_edit')[0].reset();

							$('#main .address .add').remove();
							
							// 添加进页面
							if(data.is_def==0){
								var tr = '<td>'+data.consignee+'</td><td>'+data.district+' '+data.detail+','+data.postcode+'</td><td>'+data.tel+'</td><td class="index"><div><a class="moRen" href="javascript:;">设为默认</a><a href="javascript:;" class="add_edit">编辑</a><a href="javascript:;" class="add_del">删除</a></div><span><input type="hidden" name="is_def" value="'+data.is_def+'" /></span><p><input type="hidden" name="adid" value="'+data.adid+'" /></p></td>';
								$('table.nr_tab tr').eq(x).html(tr);
							}else{
								var tr = '<td>'+data.consignee+'</td><td>'+data.district+' '+data.detail+','+data.postcode+'</td><td>'+data.tel+'</td><td class="index"><div><p class="moRen">默认地址</p><a href="javascript:;" class="add_edit">编辑</a></div><span><input type="hidden" name="is_def" value="'+data.is_def+'" /></span><p><input type="hidden" name="adid" value="'+data.adid+'" /></p></td>';
								$('table.nr_tab tr').eq(x).html(tr);
							}
							
						}
					})
					return false;
				});
			})
		</script>

		<!-- 编辑地址 -->
		<form action="" id="form_edit">
			<div class="city_edit">
				<h3>编辑地址</h3>
				<ul>
					<li>
						<p class="title"><span>*</span> 收&nbsp;&nbsp;货&nbsp;&nbsp;人：</p>
						<input type="text" name="consignee" placeholder="请准确填写真实姓名" class="consignee" />
						<div class="white"></div>
						<div class="adhide"><span></span>
							<p>请准确填写真实姓名 </p>
						</div>
					</li>
					<li>
						<p class="title"><span>*</span> 地　　区：</p>
						<select name="district[]" id="areas1"></select>
						<select name="district[]" id="areas2"></select>
						<select name="district[]" id="areas3"></select>
						<div class="white"></div>
						<div class="adhide"><span></span>
							<p>请选择省份 </p>
						</div>
					</li>
					<li>
						<p class="title"><span>*</span> 详细地址：</p>
						<input type="text" name="detail" placeholder="请填写详细路名及门牌号" class="detail" />
						<em> 配送范围与配送时间 </em>
						<div class="white"></div>
						<div class="adhide"><span></span>
							<p>请填写详细路名及门牌号 </p>
						</div>
					</li>
					<li>
						<p class="title"><span>*</span> 邮政编码：</p>
						<input type="text" name="postcode" placeholder="请填写正确的邮政编码" class="postcode" />
						<div class="white"></div>
						<div class="adhide"><span></span>
							<p>请填写正确的邮政编码 </p>
						</div>
					</li>
					<li>
						<p class="title"><span>*</span> 手　　机：</p>
						<input type="text" name="tel" placeholder="请填写正确的手机号码" class="tel" />
						<div class="white"></div>
						<div class="adhide"><span></span>
							<p>请填写正确的手机号码 </p>
						</div>
					</li>
					<li class="hide"></li>
				</ul>
				<a href="" class="adclose">X</a>
				<input type="submit" value="保存地址" class="tijiao">
				<a href="javascript:;" class="quxiao">取消编辑</a>
			</div>
			<div class="js"></div>
		</form>
		<!--网页底部-->
		<div id="footer">
    <ul>
        <li>
            <h2>关于凡客</h2>
            <p><a href="">公司简介</a></p>
            <p><a href="">联系我们</a></p>
            <p><a href="">友情链接</a></p>
        </li>
        <li>
            <h2>新手指南</h2>
            <p><a href="">账户注册</a></p>
            <p><a href="">购物流程</a></p>
            <p><a href="">网站地图</a></p>
        </li>
        <li>
            <h2>配送时间及时间</h2>
            <p><a href="">国内配送</a></p>
            <p><a href="">订单拆分</a></p>
        </li>
        <li>
            <h2>支付方式</h2>
            <p><a href="">货到付款</a></p>
            <p><a href="">在线支付</a></p>
            <p><a href="">礼品卡及账户余额</a></p>
            <p><a href="">其他支付方式</a></p>
        </li>
        <li>
            <h2>售后服务</h2>
            <p><a href="">退换货政策</a></p>
            <p><a href="">退换货办理流程</a></p>
            <p><a href="">退换货网上办理</a></p>
            <p><a href="">退款说明</a></p>
        </li>
        <li style="border: none;">
            <h2>帮助中心</h2>
            <p><a href="">在线客服</a></p>
            <p><a href="">找回密码</a></p>
            <p><a href="">隐私声明</a></p>
        </li>
    </ul>
</div>
		<div id="footer_bg">
			<ul>
				<li>
					<a href="javascript:;" class="index_1"></a>
				</li>
				<li>
					<a href="javascript:;" class="index_2"></a>
				</li>
				<li>
					<a href="javascript:;" class="index_3"></a>
				</li>
				<li>
					<a href="javascript:;" class="index_4"></a>
				</li>
			</ul>
		</div>
		<!--网页底部结束-->
		<!--网页结束-->
		<div id="bottom">
			<p>Copyright 2007 - 2016 vancl.com All Rights Reserved 出版物经营许可证新出发京批字第直xxxxx号</p>
			<div>
				<a href="javascript:;" class="index_1"></a>
				<a href="javascript:;" class="index_2"></a>
				<a href="javascript:;" class="index_3"></a>
				<a href="javascript:;" class="index_4"></a>
				<a href="javascript:;" class="index_5"></a>
				<a href="javascript:;" class="index_6"><img src="http://localhost/xiangmu/shop/Public/Home/images/kexin_brand_for_others.png" alt="" /></a>
			</div>
		</div>

        <!-- 返回顶部js -->
        <script type="text/javascript">
            $(function() {
                $(window).scroll(function(){
                    var scrolltop=$(this).scrollTop();      
                    if(scrolltop>=200){     
                        $(".toolbar").show();
                    }else{
                        $(".toolbar").hide();
                    }
                });     
                $(".toolbar-item-top").click(function(){
                    $("html,body").animate({scrollTop: 0}, 600);    
                });     
                
            })
        </script>
		<!--返回顶部-->
		<div class="toolbar" style="display:none;">
           <a href="###" class="toolbar-item toolbar-item-weixin">
           <span class="toolbar-layer"></span>
           </a>
           <a href="###" class="toolbar-item toolbar-item-feedback"></a>
           <a href="###" class="toolbar-item toolbar-item-app">
            <span class="toolbar-layer"></span>
           </a>
           <a href="javascript:;" class="toolbar-item toolbar-item-top"></a>
        </div>

	</body>

</html>